<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 00:33:05
 * @LastEditTime: 2023-11-08 15:33:42
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: BOM成品工艺
 */

namespace App\Models;

use App\Traits\AutoCodeTrait;
use App\Traits\AttachmentTrait;

class ProColorApply extends BaseModel
{
    use AttachmentTrait;
    use AutoCodeTrait;
    protected $ACSign = 'SAMPLE_APPLY';
    public $timestamps = true;
    public $table = "sys_pro_color_apply";
    protected $guarded = [];

    public function customer()
    {
        return $this->belongsTo(Company::class);
    }
    public function details()
    {
        return $this->hasMany(ProColorApplyDetails::class, "main_id");
    }
    public function status()
    {
        return $this->belongsTo(Dic::class, "status_id", "key")->where(function ($q) {
            $q->where("code", 'table_status');
        });
    }
}
